/**
 * 1. 类型别名 type
 *
 * */

type Name = string;
type NameResolve = () => string;
type MyNameResolve = Name | NameResolve;

/**
 * 2. 字符串字面量类型; 定义好的eventnames 
 *
 * */

type EventNames = 'click' | 'scroll' | 'mousemove';
function handleEvent(ele: Element, event: EventNames) {
  console.log('这是handleEvent');
}

handleEvent(document.getElementById('#foo'), 'click');

/**
 * 2. 元组
 *
 * */

let xiaomin: [string, number];
xiaomin[0] = 'age';
xiaomin[1] = 25;
xiaomin = ['age', 25];

/**
 * 3. 枚举 enum
 *
 * */

enum Days { sun, Mon, Tue, Wed, Thu, Fri, Sat }
Days['sun'] === 0;